// 检查是否获胜
bool check_win(char chessboard[][COL])
{
    // 检查行
    for (int i = 0; i < ROW; i++)
    {
        for (int j = 0; j <= COL - 5; j++)
        {
            if (chessboard[i][j] != '0' &&
                chessboard[i][j] == chessboard[i][j + 1] &&
                chessboard[i][j] == chessboard[i][j + 2] &&
                chessboard[i][j] == chessboard[i][j + 3] &&
                chessboard[i][j] == chessboard[i][j + 4])
            {
                return true;
            }
        }
    }
    // 检查列
    for (int j = 0; j < COL; j++)
    {
        for (int i = 0; i <= ROW - 5; i++)
        {
            if (chessboard[i][j] != '0' &&
                chessboard[i][j] == chessboard[i + 1][j] &&
                chessboard[i][j] == chessboard[i + 2][j] &&
                chessboard[i][j] == chessboard[i + 3][j] &&
                chessboard[i][j] == chessboard[i + 4][j] )
            {
                return true;
            }
        }
    }
    // 检查主对角线
    for (int i = 0; i <= ROW - 5; i++)
    {
        for (int j = 0; j <= COL - 5; j++)
        {
            if (chessboard[i][j] != '0' &&
                chessboard[i][j] == chessboard[i + 1][j + 1] &&
                chessboard[i][j] == chessboard[i + 2][j + 2] &&
                chessboard[i][j] == chessboard[i + 3][j + 3] &&
                chessboard[i][j] == chessboard[i + 4][j + 4])
            {
                return true;
            }
        }
    }
    // 检查副对角线
    for (int i = 0; i <= ROW - 5; i++)
    {
        for (int j = 4; j < COL; j++)
        {
            if (chessboard[i][j] != '0' &&
                chessboard[i][j] == chessboard[i + 1][j - 1] &&
                chessboard[i][j] == chessboard[i + 2][j - 2] &&
                chessboard[i][j] == chessboard[i + 3][j - 3] &&
                chessboard[i][j] == chessboard[i + 4][j - 4])
            {
                return true;
            }
        }
    }
    return false;
}
